home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 3 / Gold Medal Software - Volume 3 (Gold Medal) (1994).iso / tutor / pcl61b.arj / PART6.EXE / DBTIPS.TUT < prev    next >
Text File  |  1993-08-16  |  17KB  |  320 lines

  1.        
  2.        The following information is reprinted with permission, Ultimate 
  3.        Power Tips 1.0A (c) 1992, 1993  Paul Scanlon, Scanlon Enterprises 
  4.        
  5.  
  6.        ---------------------------------------------------------------- 
  7.  
  8.                               DATA BASE POWER TIPS
  9.  
  10.        ---------------------------------------------------------------- 
  11.  
  12.         Effective Data Base Reports
  13.  
  14.         Effective data base reports turn data into information, but if 
  15.         your readers can't tell what they're looking at, the report is 
  16.         nothing but a dead tree! An informative title and clear column 
  17.         headings go a long way toward telling a reports story.
  18.  
  19.         Use two-part report headlines. For the title, carefully, choose 
  20.         descriptive words commonly employed in your business which never 
  21.         change. Next, build a modifiable heading, which identifies the 
  22.         data set on the particular report. This is especially important 
  23.         if you use the same report form (or layout) for more than one 
  24.         type of report. Suppose, you use the same layout to generate two 
  25.         reports on customers, but select the listings by different 
  26.         criteria. One report might show all of your customers, while the 
  27.         other might include only those who haven't bought anything this 
  28.         year. Using the same report form, not only saves you time, but 
  29.         if you use a layout consistently, your co-workers will know, for 
  30.         instance, that the last purchase date is always in the fifth 
  31.         column. But, if both reports have the same headline, you'll have 
  32.         some confused and angry co-workers. Everyone will be much 
  33.         happier if you name these reports something like "Customers" and 
  34.         "Inactive Customers". Most data managers let you supply report 
  35.         headings at run time.
  36.  
  37.         Sorted Details: The heading can do double duty, by telling your 
  38.         readers what order the records are in. Most people, assume that 
  39.         a report is sorted by, or printed in the order of, its left-hand 
  40.         column. It's therefore best to design a report form with the 
  41.         sorted column (be it NAME, ZIP or something else), on the left. 
  42.         This is NOT always possible, especially if you're using the same 
  43.         report form for a number of reports. The solution, specify the 
  44.         sort order in your heading, as in "Inactive Customers (No 
  45.         Purchase in 1991)".
  46.  
  47.         At the head of the Column: After the report heading, the column 
  48.         headings are the best clues to what's on the report. The easiest 
  49.         (but not necessarily the smartest) thing to do is simply accept 
  50.         default in many report writers and use the field names provided. 
  51.         If the fields have simple names, like, "Phone", that's no 
  52.         problem, but a column headed "DTPOST" will confuse the boss. 
  53.         Therefore, when the field name is a code or abbreviation, spell 
  54.         it out in the column heading. For instance, "Date Posted" is 
  55.         much easier to understand at a glance, that "DTPOST". If your 
  56.         description column heading is wider that its column, split it 
  57.         into two lines. You can do this with virtually all report 
  58.         writers. Once you've spelled out your column headings, format 
  59.         then for easy reading. Parallel justification is important. A 
  60.         left justified or centered heading will look confusing over a 
  61.         column of right justified numbers. AS a general rule, you should 
  62.         left justify character column headings, center those above dates 
  63.         and long descriptions and right justify heading over numbers. 
  64.         Other column heading design tips: Use uppercase and lower case 
  65.         letters. They're easier to read than all uppercase or lower 
  66.         case. Put a line below each column heading, stretching the full 
  67.         width of the column. If you've put some thought into your report 
  68.         heading and column headings, the people who read your reports 
  69.         will be happier. In the long career run, this will make you a 
  70.         happy camper.
  71.  
  72.  
  73.  
  74.         Naming Reports As You Print Them
  75.  
  76.         How would you go about printing, from a data base of all your 
  77.         customers, a report of just those customers added since last 
  78.         July? Assuming your report form is called CUSTLIST.FRM and your 
  79.         date field is called "First_Sale", the obvious answer is to use 
  80.         the command "REPORT FORM CustList TO PRINT FOR First_Sale >= C 
  81.         TO D("07/01/90")". One extra step will give your report a title 
  82.         that accurately reflects the data in the new report. The dBase 
  83.         REPORT command, has a little used HEADINGS option, that lets you 
  84.         add a title at print time. If you change the command to "REPORT 
  85.         FORM CustList TO PRINT FOR First_Sale >= C TO D("07/01/90") 
  86.         HEADING "Customers Added Since July 1, 1990", the resulting 
  87.         report will be much clearer to your co-workers.
  88.  
  89.  
  90.         Enhance Your dBase Logic Field Usage
  91.  
  92.         Tired of explaining what T and F stand for in DBase III Plus 
  93.         Reports? If your DBase reports often display the contents of 
  94.         logical fields, you'll produce more readable output by using 
  95.         DBase's IFF() function with the Active expression to substitute 
  96.         words for the logical values. Suppose you have a file called 
  97.         Vendors with a logical field called Active, containing T & F in 
  98.         a report column, instead of the Active Expression itself, use 
  99.         "IFF(ACTIVE,'YES','NO'". You can also use "IFF(ACTIVE, 
  100.         'Active','Inactive'".
  101.  
  102.  
  103.  
  104.         Add Printer Codes for Better-Looking dBase Output
  105.  
  106.         You can spruce up dBase III plus reports by using printer 
  107.         control codes to produce compressed type, underlining, boldface 
  108.         and other print styles. Just use the following commands. ".SET 
  109.         DEVICE TO PRINT"
  110.                   ".@ PROW(),PCOL() SAY CHR(15)"
  111.                   ".SET DEVICE TO SCREEN"
  112.         In the example above, "@ PROW(),PCOL() SAY" sends the control 
  113.         code "CHR(15)" (compressed type for Epson and IBM compatibles), 
  114.         to the printer at its current location. Substitute other control 
  115.         codes (which of course must be specific to your printer) to 
  116.         effect other print styles. The commands can be entered at the 
  117.         dot prompt, saved in their own command file or used within other 
  118.         command files.
  119.  
  120.  
  121.  
  122.         Paradox Shortcut, Pick Your Own Editor
  123.  
  124.         If you don't like the Paradox Script Editor, you can assign 
  125.         another ASCII text editor, such as Brief or Word, to run in 
  126.         Paradox. First be sure the text editors directory is referenced 
  127.         by the system PATH statement. From Paradox's main menu, select 
  128.         Script Play and type "CUSTOM" and press <ENTER>. Now answer the 
  129.         prompt about your monitor, and from a subsequent menu, choose 
  130.         Pal Editor. Type the name of the executable file that invokes 
  131.         your text editor, and follow it with a space and an asterisk. 
  132.         The asterisk, indicates that you want whatever script file is 
  133.         loaded when you invoke the editor. Also, you can put an 
  134.         exclamation point before the editors file name to give the 
  135.         editor more memory, and/or you can add another space and two 
  136.         more asterisks to end the line if your editor can accept a line 
  137.         number that jumps you to that position in the script. To exit, 
  138.         press <ENTER>, select Return Do-It, Do-It, save the CFG file to 
  139.         either the harddisk or Network. Paradox will close. The next 
  140.         time you load Paradox, Script Play will summon your favorite 
  141.         editor.
  142.  
  143.  
  144.  
  145.         dBase & Foxbase do Multiline Reporting
  146.  
  147.         Still stuck with an old dBase III Plus or Foxbase report writer? 
  148.         It may seem impossible to build a multiline report, but it's 
  149.         NOT. Here's the trick. Placing a semicolon within the column 
  150.         contents will wrap the column to the next line. This lets you 
  151.         load a multiline group of expressions, such as a three line 
  152.         address block, into a single column. To do this, enter the 
  153.         column contents, such as the following, into a single column. 
  154.  
  155.         TRIM(FNAME) + " " + TRIM(LNAME) + ";" + ADDRESS + ";" + 
  156.         TRIM(CITY) + " " + STATE + " " + ZIP
  157.  
  158.         The above should be entered continuously. Set the column width 
  159.         no narrower that the widest possible combination of data 
  160.         appearing between the semicolons, otherwise, you'll get 
  161.         unintended word wrap effects. Unfortunately, there's no easy way 
  162.         to box and address. For that you'll have to upgrade.
  163.  
  164.  
  165.         From a Table to a Form
  166.  
  167.         A Browse screen table view shows you many records at once, while 
  168.         an Edit screen form gives you a clearer view of one record. 
  169.         dBase III Plus, offers no way to toggle easily between these 
  170.         views, but you can create such a toggle by programming. Here's 
  171.         how to do it with the least amount of code :
  172.                 X = .F.
  173.                 DO WHILE .NOT. X
  174.                    BROWSE
  175.                    EDIT
  176.                    @21,37 SAY "Exit?" GET X
  177.                    READ
  178.                 ENDDO
  179.                 RETURN
  180.         This example assumes that your data file is already open. The 
  181.         program starts a loop, that brings up the Browse screen, 
  182.         (dBase's table view). Here, you can scroll through your data and 
  183.         even edit it. When you exit Browse, by pressing <ESC> or <Ctrl>W 
  184.         the Edit screen appears, showing the record that was highlighted 
  185.         when you exited Browse. When you exit Edit, with <ESC>, you'll 
  186.         be asked if you want to exit the program. If you respond with 
  187.         "Y" or "T", the program terminates. If you answer "N" or "F", 
  188.         the program resumes looping, and brings you back to the Browse 
  189.         screen.
  190.  
  191.  
  192.  
  193.         Making a Form Your Own
  194.  
  195.         When you view data in Paradox, <F7> acts as a hot key for going 
  196.         between the table and form views. By default, the form displayed 
  197.         with the hot key is a simple vertical listing of your table's 
  198.         fields. But Paradox lets you redesign this form to make it 
  199.         easier to read. For instance, you can place CITY, STATE & ZIP 
  200.         fields on a single line. To change the form display, select 
  201.         Forms Change from the MAIN menu. Enter the name of your table 
  202.         when prompted, and press <ENTER> to select the highlighted "F" 
  203.         from the list of forms that can be changed. (Other forms are 
  204.         listed by number. If the table has no other forms, only the "F" 
  205.         will be displayed.) Enter a description for the form, or press 
  206.         <ENTER> to keep the default, STANDARD FORM. That boring Standard 
  207.         Form now appears. Pressing <F10> brings up a menu of options for 
  208.         changing the look and, for that matter, the functionality of the 
  209.         form. For instance, you can use the Area Move command to move a 
  210.         field to another part of the screen, or the Border Place command 
  211.         to draw a box. Explore the menus to see what else is available. 
  212.         Once you are satisfied with your new form, press <F2> to save 
  213.         your work and exit. The next time you press <F7> from a table 
  214.         view, the current record will pop up using your new and improved 
  215.         form.
  216.  
  217.  
  218.  
  219.         Copy a Calculated Field in Paradox
  220.  
  221.         When you're designing a report, with a number of similar, 
  222.         complex, calculated fields, it's handy to copy a formula from 
  223.         one field to another. Unfortunately, Paradox, has no commands 
  224.         for doing this. You can get around this shortcoming, by creating 
  225.         an instant Script macro when you first enter the formula. While 
  226.         designing a report, before creating the first calculated field, 
  227.         press <Alt><F3> to start keystroke recording to an Instant 
  228.         Script. Then press <F10> and select Field Place Calculated. Next 
  229.         type in your formula, and press <ENTER> <Alt><F3> to end 
  230.         recording. When you want to place a similar calculated field in 
  231.         another location, simply press <Alt><F4> to play the Instant 
  232.         Script. You will soon be prompted to place the field. Press 
  233.         <ESC> <Ctrl>F, edit the formula, press <ENTER>, and place the 
  234.         field as prompted.
  235.  
  236.  
  237.  
  238.         Multi-Config for Q&A
  239.  
  240.         Changes made at Q&A's Utilities Set Global Defaults screen are 
  241.         saved in a file called QA.CFG. If you want to have alternative, 
  242.         reusable configurations, save one configuration before creating 
  243.         another, and copy this file to another name, such as QA2.CFG. To 
  244.         use QA2.CFG, copy it back to QA.CFG. This copy back and forth 
  245.         can be automated via a batch file. Don't forget to save the 
  246.         original QA.CFG, by copying it to a temporary file, such as 
  247.         QA.TMP, before you copy the QA2.CFG to QA.CFG.
  248.  
  249.         EXAMPLE: COPY the current QA.CFG file to QA1.CFG, you have now 
  250.         cloned the current config information. Now, enter Q&A's 
  251.         Utilities Set Global Defaults Screen, and set up your second Q&A 
  252.         configuration. EXIT Q&A and copy the new QA.CFG to QA2.CFG. Now, 
  253.         make two batch files, one called QA1.BAT the other QA2.BAT. The 
  254.         first line in each batch file will copy the correct QA config 
  255.         file. For QA1.BAT, this should be "COPY QA1.CFG QA.CFG", and for 
  256.         QA2.BAT, this should be "COPY QA2.CFG QA.CFG".
  257.  
  258.  
  259.  
  260.         Getting the Right Record With DBase III Plus
  261.  
  262.         Set Relation, which links two data bases by a common key, is one 
  263.         of the most powerful DBase III Plus commands. However, Set 
  264.         Relation has one undocumented quirk that can produce undesirable 
  265.         results. When DBase searches the child data base for the first 
  266.         key that matches the parent data base's key, the matching record 
  267.         may be a deleted one, even if Set Delete is on. To avoid this 
  268.         problem, ensure that the child data base contains no deleted 
  269.         records before you create the relation by issuing a Pack 
  270.         command.
  271.  
  272.  
  273.  
  274.         Duplicating Paradox Entries
  275.  
  276.         When working with Paradox 3.0+, it is often necessary to 
  277.         duplicate the contents of a field from one record to the next. 
  278.         To do this, use the Paradox "Ditto" key, which copies the value 
  279.         from the same field of the previous record. The "Ditto" key is 
  280.         the combined keystroke <Ctrl>-D. This key combination is listed 
  281.         in the index of both the Paradox Introduction and the User's 
  282.         Guide manual.
  283.  
  284.  
  285.  
  286.  
  287.         Reporting From a Paradox Query
  288.  
  289.         Paradox offers no direct way to print a report of only some of 
  290.         the records in a table. If you need a list of customers added 
  291.         since last July, for instance, you can't use your Customer 
  292.         table's Report R to print it. You can create an Ask query, that 
  293.         lists only those customers, then use the Tools Copy Report 
  294.         command to copy your report form from the Customer to the Answer 
  295.         table. Printing Answer's report rather than the Customer's will 
  296.         give you the selection you want. Even then, the reports' title 
  297.         won't state which customers are listed, and Paradox 3.0+ has no 
  298.         way to change a report title when you print it. So, before 
  299.         printing, the report, you'll have to use the Report Change 
  300.         command to change the name manually. Do this after you've copied 
  301.         the report to the Answer table, and be sure to change the name 
  302.         of the copy, not the original. If you have Paradox 3.5 is 
  303.         easier. When creating or changing the report, put a calculated 
  304.         field in the title's place, using a variable name as the 
  305.         expression. From then on, changing the contents of the variable 
  306.         will change the title of the report. <Alt><F10>MiniScript is an 
  307.         easy way to do this.
  308.  
  309.  
  310.        
  311.        Tutorial finished. Have you registered PC-Learn to receive your
  312.        bonus disks? Registration is encouraged. Shareware works on the
  313.        honor system! Send $25 to Seattle Scientific Photography, 
  314.        Department PCL6, PO Box 1506, Mercer Island, WA 98040. Latest 
  315.        version of PC-Learn and two bonus disks shipped promptly!
  316.  
  317.  
  318.  
  319.  
  320.